<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class Finance extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('finance', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('customer_id')->default(0)->comment('客户id');
            $table->unsignedBigInteger('order_id')->default(0)->comment('订单id');
            $table->string('num')->nullable()->comment('订单号');
            $table->decimal('money',10,2)->nullable()->comment('收款金额');
            $table->tinyInteger('pay_type')->default(0)->comment('收支方式');
            $table->text('remark')->nullable()->comment('备注');
            $table->text('multiple_file')->nullable()->comment('付款凭证附件，多个用,隔开');
            $table->unsignedBigInteger('owner_user_id')->default(0)->comment('所属人ID');
            $table->string('owner_user_nickname')->nullable()->comment('所属人名称');
            $table->unsignedBigInteger('owner_department_id')->default(0)->comment('所属人部门ID');

            $table->tinyInteger('check_status')->default(1)->comment('审核状态：1待审核，2审核不通过，3审核通过，默认1');
            $table->text('check_result')->nullable()->comment('审核结果内容');
            $table->dateTime('check_time')->nullable()->comment('审核时间');
            $table->unsignedBigInteger('check_user_id')->default(0)->comment('审核用户ID');
            $table->string('check_user_nickname')->nullable()->comment('审核用户名称');
            $table->timestamps();

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('finance');
    }
}
